<template>
  <view class="box">
    <!-- #ifdef MP-WEIXIN -->
    <view
      class="head"
      :style="
        'padding-top:' +
        statusBarHeight1 +
        'px;padding-right:' +
        (WXwidth + 15) +
        'px;height:' +
        (statusBarHeight1 + 44) +
        'px'
      "
    >
      <!-- #endif -->
      <!-- #ifndef MP-WEIXIN -->
      <view
        class="head"
        :style="
          'padding-top:' + (statusBarHeight1 + 10) + 'px;height:' + (statusBarHeight1 + 54) + 'px'
        "
      >
        <!-- #endif -->
        <view style="width: 124rpx">
          <image
            class="fanhui"
            @click="fanhui"
            src="https://pic.bangbangtongcheng.com/static/fanhui_bai.png"
            mode=""
          >
          </image>
        </view>
        <view class="centers"> 认证信息 </view>
        <view style="width: 124rpx"> </view>
        <!-- <view @click="oneClickAuthentication" class="head_right">
				一键认证
			</view> -->
      </view>
      <!-- #ifdef MP-WEIXIN -->
      <view
        :style="
          'padding-top:' +
          statusBarHeight1 +
          'px;height:' +
          (statusBarHeight1 + 44) +
          'px;background-color: #64B6A8;'
        "
      >
      </view>
      <!-- #endif -->
      <!-- #ifndef MP-WEIXIN -->
      <view
        :style="
          'padding-top:' +
          statusBarHeight1 +
          'px;height:' +
          (statusBarHeight1 + 54) +
          'px;background-color: #64B6A8;'
        "
      >
      </view>
      <!-- #endif -->
      <scroll-view scroll-y class="scroll-view">
        <form>
          <view class="cu-form-group">
            <view class="title"> <span style="color: red">*</span>真实姓名 </view>
            <input type="text" v-model="dprzData.realName" placeholder="请填写真实姓名" />
          </view>
          <view class="cu-form-group">
            <view class="title"> <span style="color: red">*</span>性&emsp;&emsp;别 </view>
            <view class="xbRadio">
              <view class="radio" @click.stop="tabClickxb(1)">
                <view class="radio_item" :class="sexual == 1 ? 'radioxz' : ''"></view>
                <span>男</span>
              </view>
              <view class="radio" @click.stop="tabClickxb(2)">
                <view class="radio_item" :class="sexual == 2 ? 'radioxz' : ''"></view>
                <span>女</span>
              </view>
            </view>
          </view>
          <view class="cu-form-group">
            <view class="title"> <span style="color: red">*</span>出生年月日 </view>
            <picker
              mode="date"
              @change="bindDateChang"
              :value="dprzData.birthYears"
              start="1980-01-01"
              :end="endDate"
            >
              <view style="height: 100rpx; display: flex; align-items: center">{{
                dprzData.birthYears || '请选择'
              }}</view>
            </picker>
          </view>
          <view class="cu-form-group">
            <view class="title"> <span style="color: red">*</span>身份证号 </view>
            <input
              type="text"
              v-model="dprzData.idNumber"
              @input="sfzInput"
              maxlength="18"
              placeholder="请填写身份证号"
            />
          </view>
          <!-- 身份证 -->
          <view class="cu-form-group">
            <view class="title"> <span style="color: red">*</span>本人身份证（人像面） </view>
          </view>
          <view class="sfz">
            <view class="cu-form-group">
              <view class="grid col-4 grid-square flex-sub">
                <view
                  class="bg-img id_card"
                  v-for="(item, index) in imgList9"
                  :key="index"
                  @tap="ViewImage9"
                  :data-url="imgList9[index]"
                >
                  <image :src="imgUrl + imgList9[index]" mode="aspectFit" />
                  <view
                    class="cu-tag bg-red"
                    @tap.stop="DelImg9"
                    :data-index="index"
                    v-if="status != 0"
                  >
                    <text class="cuIcon-close"></text>
                  </view>
                </view>
                <view class="solids id_card" @tap="ChooseImages(9)" v-if="imgList9.length < 1">
                  <view
                    style="
                      z-index: 1;
                      position: absolute;
                      width: 380rpx;
                      left: 50%;
                      top: 50%;
                      transform: translate(-50%, -50%);
                      display: flex;
                      flex-direction: column;
                      align-items: center;
                    "
                  >
                    <img
                      style="width: 60rpx; height: 60rpx"
                      src="https://pic.bangbangtongcheng.com/6579f8a312604aee9defb7d8837c1b0b"
                      alt=""
                    />
                    <view class="" style="margin-top: 11rpx; color: #64b6a8; font-size: 28rpx">
                      上传个人身份证（人像面）
                    </view>
                  </view>
                  <img
                    style="width: 100%; height: 100%"
                    src="https://pic.bangbangtongcheng.com/6f240bc939fa48579c99ce4287752da0"
                    alt
                  />
                </view>
              </view>
            </view>
          </view>
          <view class="cu-form-group">
            <view class="title"> <span style="color: red">*</span>本人身份证（国徽面） </view>
          </view>
          <view class="sfz">
            <view class="cu-form-group">
              <view class="grid col-4 grid-square flex-sub">
                <view
                  class="bg-img id_card"
                  v-for="(item, index) in imgList10"
                  :key="index"
                  @tap="ViewImage10"
                  :data-url="imgList10[index]"
                >
                  <image :src="imgUrl + imgList10[index]" mode="aspectFit" />
                  <view
                    class="cu-tag bg-red"
                    @tap.stop="DelImg10"
                    :data-index="index"
                    v-if="status != 0"
                  >
                    <text class="cuIcon-close"></text>
                  </view>
                </view>
                <view class="solids id_card" @tap="ChooseImages(10)" v-if="imgList10.length < 1">
                  <view
                    style="
                      z-index: 1;
                      position: absolute;
                      width: 380rpx;
                      left: 50%;
                      top: 50%;
                      transform: translate(-50%, -50%);
                      display: flex;
                      flex-direction: column;
                      align-items: center;
                    "
                  >
                    <img
                      style="width: 60rpx; height: 60rpx"
                      src="https://pic.bangbangtongcheng.com/6579f8a312604aee9defb7d8837c1b0b"
                      alt=""
                    />
                    <view class="" style="margin-top: 11rpx; color: #64b6a8; font-size: 28rpx">
                      上传个人身份证（国徽面）
                    </view>
                  </view>
                  <img
                    style="width: 100%; height: 100%"
                    src="https://pic.bangbangtongcheng.com/6f240bc939fa48579c99ce4287752da0"
                    alt
                  />
                </view>
              </view>
            </view>
          </view>
        </form>
      </scroll-view>
      <view class="tijiao">
        <view class="xieyi">
          <radio
            style="transform: scale(0.6)"
            :checked="checked"
            @click="checked = !checked"
          ></radio>
          <view style="display: inline-block; width: 630rpx">
            <span>提交认证即表示您已阅读并同意</span>
            <span style="color: #64b6a8" @click="toUs(3)">《帮帮同城用户协议》</span>和
            <span style="color: #64b6a8" @click="toUs(2)">《帮帮同城隐私协议》</span>
          </view>
        </view>
        <view class="but" v-if="status == 0">审核中，请耐心等待</view>
        <view class="but" v-if="status != 0" @click="submit">提交</view>
      </view>
      <uni-popup ref="bindsRZ" type="center">
        <view class="bindsrz_frame">
          <view class="bindsrz_frame_close">
            <image
              @click="close()"
              class="image"
              src="https://pic.bangbangtongcheng.com/static/bbzc/rz_close.png"
              mode=""
            ></image>
          </view>
          <view class="bindsrz_frame_c">使用一键认证完善信息？</view>
          <view class="bindsrz_frame_b">
            <image
              class="image"
              src="https://pic.bangbangtongcheng.com/static/bbzc/zfb_rz.png"
              mode=""
            ></image>
            一键认证
          </view>
        </view>
      </uni-popup>
      <uniBall></uniBall>
    </view>
  </view>
</template>
<script>
  import permision from '@/js_sdk/wa-permission/permission.js'
  //#ifdef H5
  import wxshare from '../../utils/index.js'
  //#endif
  import { mapGetters } from 'vuex'
  export default {
    components: {},
    data() {
      return {
        // 协议
        checked: false,
        dprzData: {
          id: '',
          userId: '',
          realName: '', //真实姓名
          sexualDistinction: '', //性别（1：男，2：女）
          birthYears: '', //出生年月
          idNumber: '', //身份证号
          personalIdCardPortrait: '', //本人身份证（人像面）
          personalIdCardNationalEmblemFace: '', //本人身份证（国徽面）
        },
        sexual: '',
        endDate: '',
        image: '',
        status: '2',
        imgList1: [],
        imgList2: [],
        imgList3: [],
        imgList9: [],
        imgList10: [],
		upload9:false,
		upload10:false,
        userInfo: uni.getStorageSync('Pduser'),
        index: -1,
        dictionaries: [],
        type8: [],
        typeIndex8: -1,
        type9: [],
        typeIndex9: -1,
        foutnum: 0,
        imgUrl: this.$imgSrc,
        amend: '',
        // 防抖
        anti_shake: false,
        // 是否重新编辑禁用
        cxbj_jy: false,
      }
    },
    computed: {
      ...mapGetters(['statusBarHeight1', 'userinfo']),
    },
    onLoad(e) {
      this.dprzData.operatorsTelephone = this.userInfo.phone
      if (uni.getStorageSync('locationState') == 1) {
        this.getLocation()
      }
      this.getDictionaries()
      this.getType()
      this.getDate()
      this.init()
      /* #ifdef H5 */
      this.jinzhi()
      /* #endif */
      this.amend = e.amend
    },
    onShow() {},
    methods: {
      init() {
        let that = this
        that.imgList9 = []
        that.imgList10 = []
        this.$myRequest
          .get('/api/mobile/personnelOwner/getPersonalAuthenticationByUserId', {
            userId: that.userInfo.id,
          })
          .then((res) => {
            if (res.personalCertification) {
              let obj = res.personalCertification
              this.dprzData.userId = obj.userId
              this.cxbj_jy = true
              this.dprzData.id = obj.id
              this.dprzData.realName = obj.realName
              this.dprzData.sexualDistinction = obj.sexualDistinction
              this.sexual = obj.sexualDistinction
              this.dprzData.birthYears = obj.birthYears
              this.dprzData.idNumber = obj.idNumber
              this.dprzData.personalIdCardPortrait = obj.personalIdCardPortrait
              this.dprzData.personalIdCardNationalEmblemFace = obj.personalIdCardNationalEmblemFace
              that.imgList9.push(obj.personalIdCardPortrait)
              that.imgList10.push(obj.personalIdCardNationalEmblemFace)
              this.status = obj.auditStatus
              if (this.status == 0) {
                uni.$u.toast('请等待审核')
              }
            }
          })
      },
      // 获取当前时间
      getDate() {
        let date = new Date()
        this.endDate = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDay()
      },
      sfzInput(e) {
        const o = e.target
        const inputRules = /[\W]/g
        this.$nextTick(function () {
          this.dprzData.idNumber = o.value.replace(inputRules, '')
        })
      },
      bindDateChang(e) {
        this.dprzData.birthYears = e.detail.value
      },
      oneClickAuthentication() {
        this.$refs.bindsRZ.open()
      },
      close() {
        this.$refs.bindsRZ.close()
      },
      tabClickxb(index) {
        this.sexual = index
        this.dprzData.sexualDistinction = index
      },
      tishi() {
        uni.showToast({
          title: '当前选择无法更改！',
          duration: 2000,
          icon: 'none',
        })
      },
      sumfountnum(e) {
        this.foutnum = e.detail.value.length
      },
      toUs(type) {
        uni.navigateTo({
          url: '/pages_my/Us?type=' + type,
        })
      },
      getDictionaries() {
        this.$myRequest
          .get('/mob/home/getDictionaries', {
            type: '7',
          })
          .then((res) => {
            this.dictionaries = res.list
          })
      },
      getType() {
        this.$myRequest
          .get('/api/mobile/personnelOwner/queryDataDictionaryList', {
            type: '8,9',
          })
          .then((res) => {
            res.dataDictionaryList.forEach((el) => {
              if (el.type == 8) {
                this.type8.push(el)
              } else if (el.type == 9) {
                this.type9.push(el)
              }
            })
          })
      },
      ViewImage1(e) {
        uni.previewImage({
          urls: this.imgList1,
          current: e.currentTarget.dataset.url,
        })
      },
      ViewImage2(e) {
        uni.previewImage({
          urls: this.imgList2,
          current: e.currentTarget.dataset.url,
        })
      },
      ViewImage3(e) {
        uni.previewImage({
          urls: this.imgList3,
          current: e.currentTarget.dataset.url,
        })
      },
      ViewImage9(e) {
        uni.previewImage({
          urls: this.imgList9,
          current: e.currentTarget.dataset.url,
        })
      },
      ViewImage10(e) {
        uni.previewImage({
          urls: this.imgList10,
          current: e.currentTarget.dataset.url,
        })
      },
      DelImg1(e) {
        uni.showModal({
          title: '',
          content: '确定要删除营业执照？',
          cancelText: '取消',
          confirmText: '确定',
          success: (res) => {
            if (res.confirm) {
              this.imgList1.splice(e.currentTarget.dataset.index, 1)
            }
          },
        })
      },
      DelImg2(e) {
        uni.showModal({
          title: '',
          content: '确定要删除身份证人像面？',
          cancelText: '取消',
          confirmText: '确定',
          success: (res) => {
            if (res.confirm) {
              this.imgList2.splice(e.currentTarget.dataset.index, 1)
            }
          },
        })
      },
      DelImg3(e) {
        uni.showModal({
          title: '',
          content: '确定要删除身份证国徽面？',
          cancelText: '取消',
          confirmText: '确定',
          success: (res) => {
            if (res.confirm) {
              this.imgList3.splice(e.currentTarget.dataset.index, 1)
            }
          },
        })
      },
      DelImg9(e) {
        uni.showModal({
          title: '',
          content: '确定要删除身份证人像面？',
          cancelText: '取消',
          confirmText: '确定',
          success: (res) => {
            if (res.confirm) {
              this.imgList9.splice(e.currentTarget.dataset.index, 1)
			  this.upload9 = false
            }
          },
        })
      },
      DelImg10(e) {
        uni.showModal({
          title: '',
          content: '确定要删除身份证国徽面？',
          cancelText: '取消',
          confirmText: '确定',
          success: (res) => {
            if (res.confirm) {
              this.imgList10.splice(e.currentTarget.dataset.index, 1)
			  this.upload10 = false
            }
          },
        })
      },
      jinzhi() {
        let _this = this
        let param = window.location.href.split('#')[0]
        uni.request({
          method: 'post',
          data: {
            url: param,
          },
          header: {
            'content-type': 'application/x-www-form-urlencoded',
          },
          url: 'https://www.bangbangtongcheng.com/conven//mob/login/getJsTicket.do',
          success(re) {
            _this.jinzhifx(re.data)
          },
        })
      },
      jinzhifx(data) {
        wxshare.config({
          debug: false, //是否打开调试
          appId: data.appId, // 公众号的唯一标识
          timestamp: data.timestamp, // 生成签名的时间戳
          nonceStr: data.nonce, // ，生成签名的随机串
          signature: data.signature, // 签名
          jsApiList: ['hideMenuItems'],
        })
        // 禁止分享
        wxshare.hideMenuItems({
          // 要隐藏的菜单项，只能隐藏“传播类”和“保护类”按钮，所有menu项见附录3
          menuList: [
            'menuItem:share:appMessage',
            'menuItem:share:timeline',
            'menuItem:share:timeline',
            'menuItem:share:qq',
            'menuItem:favorite',
            'menuItem:share:QZone',
            'menuItem:openWithSafari',
          ],
        })
      },
      async ChooseImages(type) {
        if (type == 1) {
          this.ChooseImage1()
        } else if (type == 2) {
          this.ChooseImage2()
        } else if (type == 3) {
          this.ChooseImage3()
        } else if (type == 9) {
          if(this.upload9){
            return
          }
          this.ChooseImage9()
        } else if (type == 10) {
          if(this.upload10){
            return
          }	
          this.ChooseImage10()
        }
      },
      ChooseImage1() {
        let _this = this
        _this.imgList1 = []
        uni.chooseImage({
          count: 1, //默认1
          sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
          // sourceType: ["album"], //从相册选择
          sourceType: ['camera', 'album'],
          success: (res) => {
            var imgFiles = res.tempFilePaths
            const tempFiles = res.tempFiles
            let length = ''
            // #ifdef H5
            length = tempFiles[0].name.length
            let resType = tempFiles[0].name.substring(length - 1, length)
            // #endif
            // #ifndef H5
            length = tempFiles[0].path.length
            let resType = tempFiles[0].path.substring(length - 1, length)
            // #endif
            if (resType != 'g' && resType != 'G') {
              uni.showToast({
                title: '不支持当前文件格式',
                icon: 'none',
              })
              return
            }
            if (imgFiles.length > 1) {
              uni.showToast({
                title: '图片最多不能超过1张',
                duration: 2000,
                icon: 'none',
              })
              return
            }
            var uper
            imgFiles.forEach((el) => {
              uni.showToast({
                title: '正在上传请稍后',
                icon: 'none',
                duration: 2000,
              })
              uper = uni.uploadFile({
                // 需要上传的地址
                url: 'https://www.bangbangtongcheng.com/conven/ht/attach/qnUpload',
                // filePath 需要上传的文件
                filePath: el,
                name: 'file',
                success(res1) {
                  _this.imgList1.push(JSON.parse(res1.data).data[0].url)
                },
              })
            })
            // onProgressUpdate 上传对象更新的方法
            uper.onProgressUpdate(function (res) {})
          },
          fail: (fail) => {
            if (this.$userActiveCancalAct.some(v => fail.errMsg.includes(v.failMsg))) {
              return false;
            }
            this.$SHOWMODAL_TO_SETTINGS();
          },
        })
      },
      ChooseImage2() {
        let _this = this
        _this.imgList2 = []
        uni.chooseImage({
          count: 1, //默认1
          sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
          // sourceType: ["album"], //从相册选择
          sourceType: ['camera', 'album'],
          success: (res) => {
            var imgFiles = res.tempFilePaths
            const tempFiles = res.tempFiles
            let length = ''
            // #ifdef H5
            length = tempFiles[0].name.length
            let resType = tempFiles[0].name.substring(length - 1, length)
            // #endif
            // #ifndef H5
            length = tempFiles[0].path.length
            let resType = tempFiles[0].path.substring(length - 1, length)
            // #endif
            if (resType != 'g' && resType != 'G') {
              uni.showToast({
                title: '不支持当前文件格式',
                icon: 'none',
              })
              return
            }
            if (imgFiles.length > 1) {
              uni.showToast({
                title: '图片最多不能超过1张',
                duration: 2000,
                icon: 'none',
              })
              return
            }
            var uper
            imgFiles.forEach((el) => {
              uni.showToast({
                title: '正在上传请稍后',
                icon: 'none',
                duration: 2000,
              })
              uper = uni.uploadFile({
                // 需要上传的地址
                url: 'https://www.bangbangtongcheng.com/conven/ht/attach/qnUpload',
                // filePath 需要上传的文件
                filePath: el,
                name: 'file',
                success(res1) {
                  _this.imgList2.push(JSON.parse(res1.data).data[0].url)
                },
              })
            })
            // onProgressUpdate 上传对象更新的方法
            uper.onProgressUpdate(function (res) {})
          },
          fail: (fail) => {
            if (this.$userActiveCancalAct.some(v => fail.errMsg.includes(v.failMsg))) {
              return false;
            }
            this.$SHOWMODAL_TO_SETTINGS();
          },
        })
      },
      ChooseImage3() {
        let _this = this
        _this.imgList3 = []
        uni.chooseImage({
          count: 1, //默认1
          sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
          // sourceType: ["album"], //从相册选择
          sourceType: ['camera', 'album'],
          success: (res) => {
            var imgFiles = res.tempFilePaths
            const tempFiles = res.tempFiles
            let length = ''
            // #ifdef H5
            length = tempFiles[0].name.length
            let resType = tempFiles[0].name.substring(length - 1, length)
            // #endif
            // #ifndef H5
            length = tempFiles[0].path.length
            let resType = tempFiles[0].path.substring(length - 1, length)
            // #endif
            if (resType != 'g' && resType != 'G') {
              uni.showToast({
                title: '不支持当前文件格式',
                icon: 'none',
              })
              return
            }
            if (imgFiles.length > 1) {
              uni.showToast({
                title: '图片最多不能超过1张',
                duration: 2000,
                icon: 'none',
              })
              return
            }
            var uper
            imgFiles.forEach((el) => {
              uni.showToast({
                title: '正在上传请稍后',
                icon: 'none',
                duration: 2000,
              })
              uper = uni.uploadFile({
                // 需要上传的地址
                url: 'https://www.bangbangtongcheng.com/conven/ht/attach/qnUpload',
                // filePath 需要上传的文件
                filePath: el,
                name: 'file',
                success(res1) {
                  _this.imgList3.push(JSON.parse(res1.data).data[0].url)
                },
              })
            })
            // onProgressUpdate 上传对象更新的方法
            uper.onProgressUpdate(function (res) {})
          },
          fail: (fail) => {
            if (this.$userActiveCancalAct.some(v => fail.errMsg.includes(v.failMsg))) {
              return false;
            }
            this.$SHOWMODAL_TO_SETTINGS();
          },
        })
      },
      ChooseImage9() {
        let _this = this
        _this.imgList9 = []
        uni.chooseImage({
          count: 1, //默认1
          sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
          // sourceType: ["album"], //从相册选择
          sourceType: ['camera', 'album'],
          success: (res) => {
            _this.upload9 = true
            var imgFiles = res.tempFilePaths
            const tempFiles = res.tempFiles
            let length = ''
            // #ifdef H5
            length = tempFiles[0].name.length
            let resType = tempFiles[0].name.substring(length - 1, length)
            // #endif
            // #ifndef H5
            length = tempFiles[0].path.length
            let resType = tempFiles[0].path.substring(length - 1, length)
            // #endif
            if (resType != 'g' && resType != 'G') {
              uni.showToast({
                title: '不支持当前文件格式',
                icon: 'none',
              })
              return
            }
            if (imgFiles.length > 1) {
              uni.showToast({
                title: '图片最多不能超过1张',
                duration: 2000,
                icon: 'none',
              })
              return
            }
            var uper
            imgFiles.forEach((el) => {
              uni.showToast({
                title: '正在上传请稍后',
                icon: 'none',
                duration: 2000,
              })
              uper = uni.uploadFile({
                // 需要上传的地址
                url: 'https://www.bangbangtongcheng.com/conven/ht/attach/qnUpload',
                // filePath 需要上传的文件
                filePath: el,
                name: 'file',
                success(res1) {
                  _this.imgList9.push(JSON.parse(res1.data).data[0].url)
                },
              })
            })
            // onProgressUpdate 上传对象更新的方法
            uper.onProgressUpdate(function (res) {})
          },
          fail: (fail) => {
            if (this.$userActiveCancalAct.some(v => fail.errMsg.includes(v.failMsg))) {
              return false;
            }
            this.$SHOWMODAL_TO_SETTINGS();
          },
        })
      },
      ChooseImage10() {
        let _this = this
        _this.imgList10 = []
        uni.chooseImage({
          count: 1, //默认1
          sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
          // sourceType: ["album"], //从相册选择
          sourceType: ['camera', 'album'],
          success: (res) => {
            _this.upload10 = true
            var imgFiles = res.tempFilePaths
            const tempFiles = res.tempFiles
            let length = ''
            // #ifdef H5
            length = tempFiles[0].name.length
            let resType = tempFiles[0].name.substring(length - 1, length)
            // #endif
            // #ifndef H5
            length = tempFiles[0].path.length
            let resType = tempFiles[0].path.substring(length - 1, length)
            // #endif
            if (resType != 'g' && resType != 'G') {
              uni.showToast({
                title: '不支持当前文件格式',
                icon: 'none',
              })
              return
            }
            if (imgFiles.length > 1) {
              uni.showToast({
                title: '图片最多不能超过1张',
                duration: 2000,
                icon: 'none',
              })
              return
            }
            var uper
            imgFiles.forEach((el) => {
              uni.showToast({
                title: '正在上传请稍后',
                icon: 'none',
                duration: 2000,
              })
              uper = uni.uploadFile({
                // 需要上传的地址
                url: 'https://www.bangbangtongcheng.com/conven/ht/attach/qnUpload',
                // filePath 需要上传的文件
                filePath: el,
                name: 'file',
                success(res1) {
                  _this.imgList10.push(JSON.parse(res1.data).data[0].url)
                },
              })
            })
            // onProgressUpdate 上传对象更新的方法
            uper.onProgressUpdate(function (res) {})
          },
          fail: (fail) => {
            if (this.$userActiveCancalAct.some(v => fail.errMsg.includes(v.failMsg))) {
              return false;
            }
            this.$SHOWMODAL_TO_SETTINGS();
          },
        })
      },
      fanhui() {
        uni.navigateBack({
          delta: 1,
        })
      },
      async getLocation() {
        this.getLocation1()
      },
      getLocation1() {
        let _this = this
        uni.getLocation({
          type: 'gcj02',
          highAccuracyExpireTime: '4000',
          success(res) {
            console.log(res)
            _this.latitude = res.latitude
            _this.longitude = res.longitude
            // _this.openMap();
          },
          fail:(res) => {
            console.log(res, '经纬度没有授权');
            this.$SHOWMODAL_TO_SETTINGS();
            uni.setStorageSync('locationState', 0)
            if (uni.getStorageSync('locationState') == 0) {
              // uni.showModal({
              //   title: '提示',
              //   content: '您已关闭位置权限或获取位置信息失败。',
              //   success: function (res) {
              //     if (res.confirm) {
              //       // plus.runtime.openURL("app-settings:");
              //       if (plus.os.name === 'iOS') {
              //         plus.runtime.openURL('app-settings://')
              //       } else {
              //         var Intent = plus.android.importClass('android.content.Intent')
              //         var Settings = plus.android.importClass('android.provider.Settings')
              //         var Uri = plus.android.importClass('android.net.Uri')
              //         var mainActivity = plus.android.runtimeMainActivity()
              //         var intent = new Intent()
              //         intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
              //         var uri = Uri.fromParts('package', mainActivity.getPackageName(), null)
              //         intent.setData(uri)
              //         mainActivity.startActivity(intent)
              //       }
              //     } else if (res.cancel) {
              //       console.log('用户点击取消')
              //     }
              //   },
              // })
              return false
            }
          },
        })
      },
      openMap() {
        let that = this
        if (that.latitude == '') {
          this.getLocation()
        }
        if (that.latitude == '') {
          return false
        }
        uni.chooseLocation({
          latitude: that.latitude,
          longitude: that.longitude,
          success: function (res) {
            that.dprzData.officeAddress = res.address
            that.dprzData.latitude = res.latitude
            that.dprzData.longitude = res.longitude
          },
        })
      },
      // 提交
      submit() {
        let that = this
        if (this.anti_shake) {
          return false
        }
        let data = {}
        let status = true
        if (!that.userInfo.id) {
          uni.showToast({
            title: '请先登录',
            icon: 'none',
            mask: true,
          })
          status = false
          return false
        }
        if (!that.checked) {
          uni.showToast({
            title: '请同意用户协议',
            icon: 'none',
            mask: true,
          })
          status = false
          return false
        }
        if (!that.dprzData.realName) {
          uni.showToast({
            title: '请输入真实姓名',
            icon: 'none',
            mask: true,
          })
          status = false
          return false
        }
        if (!that.dprzData.sexualDistinction) {
          uni.showToast({
            title: '请选择性别',
            icon: 'none',
            mask: true,
          })
          status = false
          return false
        }
        if (!that.dprzData.birthYears) {
          uni.showToast({
            title: '请选择出生年月日',
            icon: 'none',
            mask: true,
          })
          status = false
          return false
        }
        if (!that.dprzData.idNumber) {
          uni.showToast({
            title: '请填写身份证号',
            icon: 'none',
            mask: true,
          })
          status = false
          return false
        }
        if (this.dprzData.idNumber.length == 18 || this.dprzData.idNumber.length == 15) {
          if (uni.$u.test.idCard(this.dprzData.idNumber) === false) {
            uni.showToast({
              title: '请填写正确的身份证号',
              icon: 'none',
              mask: true,
            })
            status = false
            return false
          }
        } else {
          uni.showToast({
            title: '请填写正确的身份证号',
            icon: 'none',
            mask: true,
          })
          status = false
          return false
        }
        if (that.imgList9.length <= 0) {
          uni.showToast({
            title: '请上传本人份证（人像面）',
            icon: 'none',
            mask: true,
          })
          status = false
          return false
        }
        if (that.imgList10.length <= 0) {
          uni.showToast({
            title: '请上传本人身份证（国徽面）',
            icon: 'none',
            mask: true,
          })
          status = false
          return false
        }
        that.dprzData.userId = this.userInfo.id
        that.dprzData.personalIdCardPortrait = that.imgList9[0]
        that.dprzData.personalIdCardNationalEmblemFace = that.imgList10[0]
        if (status) {
          uni.showLoading({
            title: '提交信息中...',
          })
          this.anti_shake = true
          this.$myRequest
            .post('/api/mobile/personnelOwner/personalAttestationOrEdit', this.dprzData)
            .then((res) => {
              uni.hideLoading()
              if (res.success && res.code == 200) {
                uni.showToast({
                  title: '提交成功',
                  icon: 'none',
                  mask: true,
                })
                setTimeout(() => {
                  this.anti_shake = false
                  uni.navigateBack()
                }, 500)
                // that.init();
              } else {
                uni.showToast({
                  title: res.msg,
                  icon: 'none',
                  mask: true,
                })
                that.init()
              }
            })
        }
      },
    },
  }
</script>
<style lang="less" scoped>
  .box {
    min-height: 100vh;
    background-color: #fff;
    padding-bottom: calc(constant(safe-area-inset-bottom) + 240rpx);
    padding-bottom: calc(env(safe-area-inset-bottom) + 240rpx);
  }

  .head {
    position: fixed;
    top: 0;
    left: 0;
    width: 750rpx;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    background-color: #64b6a8;
    z-index: 1000;

    .fanhui {
      width: 40rpx;
      height: 40rpx;
    }

    .centers {
      font-size: 36rpx;
      font-weight: 400;
      color: #ffffff;
    }

    .head_right {
      width: 124rpx;
      height: 48rpx;
      border-radius: 6rpx;
      border: 1px solid #ffffff;
      font-size: 26rpx;
      font-weight: 400;
      color: #ffffff;
      display: flex;
      align-items: center;
      justify-content: center;
    }
  }

  .scroll-view {
    /* #ifdef MP  */
    height: calc(100vh - var(--status-bar-height) - 88rpx - 5px - 22px - 144rpx);
    /* #endif */
    /* #ifdef H5 || APP-PULS */
    height: calc(100vh - var(--status-bar-height) - 88rpx - 5px - 144rpx);
    /* #endif */
    /* #ifdef APP */
    height: calc(100vh - var(--status-bar-height) - 88rpx - 5px - 144rpx);
    /* #endif */
  }

  .tijiao {
    position: fixed;
    width: 100%;
    bottom: 0rpx;
    padding-bottom: 40rpx;
    padding-top: 20rpx;
    background-color: #fff;
    z-index: 98;

    .xieyi {
      margin: 0 40rpx;
      display: flex;
      align-items: flex-start;

      span {
        color: #666666;
        font-size: 26rpx;
      }
    }

    checkbox {
      vertical-align: top;
      margin-right: 6rpx;
      margin-left: 40rpx;
    }

    .but {
      width: 670rpx;
      height: 80rpx;
      background: #64b6a8;
      border-radius: 50rpx;
      font-size: 34rpx;
      text-align: center;
      line-height: 80rpx;
      color: #fff;
      margin-top: 24rpx;
      margin-left: 40rpx;
    }
  }

  .jieshao {
    background-color: #fff;

    .kuang {
      position: relative;
      width: 670rpx;
      min-height: 80rpx;
      margin-left: 40rpx;
      // padding-bottom: 40rpx;
      background-color: #fff;
      border: 1px solid #c9c9c9;

      .biaoqian {
        height: 40rpx;
        display: flex;
        justify-content: flex-end;
        align-items: center;
        margin-right: 10rpx;
        color: #64b6a8;
      }

      textarea {
        width: 620rpx;
        margin-left: 24rpx;
        margin-top: 14rpx;
        line-height: 50rpx;
        letter-spacing: 2rpx;
      }

      p {
        position: absolute;
        bottom: 20rpx;
        right: 20rpx;
        color: #999999;
      }
    }
  }

  .cu-form-group uni-picker .picker {
    text-align: left;
  }

  .cu-form-group .title {
    font-weight: 600;
    font-size: 34rpx;
  }

  .grid.col-4.grid-square > uni-view {
    width: 212rpx;
    height: 212rpx;
  }

  .sfz .id_card {
    width: 670rpx !important;
    height: 360rpx !important;
    border-radius: 10rpx !important;
    padding-bottom: 0px !important;
  }

  .grid.col-4.grid-square > uni-view:nth-child(3n) {
    margin-right: 0;
  }

  .bindsrz_frame {
    width: 600rpx;
    background-color: #ffffff;
    border-radius: 10rpx;
    text-align: center;
    padding: 20rpx;

    .bindsrz_frame_close {
      display: flex;
      align-items: center;
      justify-content: flex-end;

      .image {
        width: 32rpx;
        height: 32rpx;
      }
    }

    .bindsrz_frame_c {
      font-size: 30rpx;
      font-weight: 400;
      color: #000000;
      text-align: center;
      margin-bottom: 40rpx;
    }

    .bindsrz_frame_b {
      margin: 0 auto;
      width: 240rpx;
      height: 74rpx;
      background-color: #4598eb;
      border-radius: 14rpx;
      font-size: 30rpx;
      font-weight: 400;
      color: #ffffff;
      display: flex;
      align-items: center;
      justify-content: space-evenly;

      .image {
        width: 52rpx;
        height: 52rpx;
      }
    }
  }

  .xbRadio {
    flex: 1;
    display: flex;
    align-items: center;

    .radio {
      width: 130rpx;
      display: flex;
      align-items: center;
      margin-right: 0;

      .radio_item {
        width: 36rpx;
        height: 36rpx;
        border: 1px solid #c9c9c9;
        border-radius: 36rpx;
        margin-right: 14rpx;
      }

      span {
        font-size: 28rpx;
        font-weight: 500;
        color: #333333;
      }

      .radioxz {
        border: 1px solid #64b6a8;
        position: relative;
      }

      .radioxz::before {
        content: '';
        width: 24rpx;
        height: 24rpx;
        border-radius: 24rpx;
        background-color: #64b6a8;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
      }
    }

    .xzsj {
      flex: 1;
      display: flex;
      align-items: center;

      uni-picker {
        width: unset;
        border: 1px solid #999999;
        height: 60rpx;
        border-radius: 8rpx;
      }
    }
  }
</style>
